<template>
  <header class="admin-navbar">
    <!-- <div class="navbar-brand">
      <h1>管理后台</h1>
    </div> -->
    <!-- <div class="user-menu">
      <div class="user-info">
        <i class="fas fa-user-circle"></i>
        <span>{{ username }}</span>
      </div> -->
      <!-- <button class="logout-btn" @click="logout">
        <i class="fas fa-sign-out-alt"></i>
        <span>退出</span>
      </button> -->
    <!-- </div> -->
  </header>
</template>

<script setup>
import { computed } from 'vue'
import { useUserStore } from '@/store/user'
import { useRouter } from 'vue-router'

const userStore = useUserStore()
const router = useRouter()

const username = computed(() => userStore.username || '未登录')

const logout = () => {
  userStore.logout()
  router.push('/login')
}
</script>

<style scoped>
.admin-navbar {
  background: linear-gradient(135deg, #4da6ff 0%, #2d8cf0 100%);
  color: white;
  padding: 0 24px;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 1px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.user-info i {
  font-size: 1.2rem;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.logout-btn i {
  font-size: 0.9rem;
}
</style>